package nyu.edu.database.operation;

public enum OperationType {

	BEGIN, BEGINRO, READ, WRITE, DUMP, END, RECOVER, FAIL;

	public static OperationType getTypeFromString(String input) {
		if (input.equalsIgnoreCase("begin")) {
			return BEGIN;
		}
		if (input.equalsIgnoreCase("beginro")) {
			return BEGINRO;
		}
		if (input.equalsIgnoreCase("r")) {
			return READ;
		}
		if (input.equalsIgnoreCase("w")) {
			return WRITE;
		}
		if (input.equalsIgnoreCase("dump")) {
			return DUMP;
		}
		if (input.equalsIgnoreCase("end")) {
			return END;
		}
		if (input.equalsIgnoreCase("recover")) {
			return RECOVER;
		}
		if (input.equalsIgnoreCase("fail")) {
			return FAIL;
		}
		return null;
	}

}
